<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>

</head>
<body>

<script type="text/javascript" src="res/vue.js"></script>
<script type="text/javascript" src="res/axios.js"></script>
<h1>添加用户</h1>
<div id="main">
    用户名
    <input v-model="name" type='text' id='name'/> <br>
    <br>
    密码
    <input v-model="pwd" type='text' id='pwd'/>
    <br>
    <br>
    性别
    <select id="sex" style="width: 150px" v-model="sex">
        <option value="男">男</option>
        <option value="女">女</option>
    </select>

    <input type='button' value='add to user' id='add' @click="add">
</div>


</body>
<script type="text/javascript">

    let vue = new Vue({
        el: "#main",
        data: {
            name: "",
            pwd: "",
            sex: ""
        },
        methods: {
            add() {
                //  var time = new Date().getTime();
                let url = "add.do";
                axios.get(url, {
                    params: {
                        name: this.name,
                        pwd: this.pwd,
                        sex: this.sex
                    }
                }).then((res) => {
                    alert(res.data.msg);
                });
            }
        }
    });


</script>
</html>